package com.hunk.springMvcExercise.web.dao;

import java.io.Serializable;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 12-3-30
 * Time: 下午2:24
 * To change this template use File | Settings | File Templates.
 */
public interface BaseDao<T, PK extends Serializable> {

    public void save(T entity);

    public void delete(T entity);

    public void delete(PK id);

    public T get(PK id);

    public java.util.List<T> get(java.util.Collection<PK> ids);

    public java.util.List<T> getAll();

    public java.util.List<T> getAll(java.lang.String orderByProperty, boolean isAsc);

    public java.util.List<T> findBy(java.lang.String propertyName, java.lang.Object value);

    public T findUniqueBy(java.lang.String propertyName, java.lang.Object value);

    public <X> java.util.List<X> find(java.lang.String hql, java.lang.Object... values);

    public <X> java.util.List<X> find(java.lang.String hql, java.util.Map<java.lang.String,?> values);

    public <X> X findUnique(java.lang.String hql, java.lang.Object... values);

    public <X> X findUnique(java.lang.String hql, java.util.Map<java.lang.String,?> values);

    public int batchExecute(java.lang.String hql, java.lang.Object... values);

    public int batchExecute(java.lang.String hql, java.util.Map<java.lang.String,?> values);

//    public org.hibernate.Query createQuery(java.lang.String queryString, java.lang.Object... values);

//    public org.hibernate.Query createQuery(java.lang.String queryString, java.util.Map<java.lang.String,?> values);

//    public java.util.List<T> find(org.hibernate.criterion.Criterion... criterions);

//    public T findUnique(org.hibernate.criterion.Criterion... criterions);

//    public org.hibernate.Criteria createCriteria(org.hibernate.criterion.Criterion... criterions);

    public void initProxyObject(java.lang.Object proxy);

    public void flush();

//    public org.hibernate.Query distinct(org.hibernate.Query query);

//    public org.hibernate.Criteria distinct(org.hibernate.Criteria criteria);

    public java.lang.String getIdName();

    public boolean isPropertyUnique(java.lang.String propertyName, java.lang.Object newValue, java.lang.Object oldValue);

    //TODO format omPage
//    public org.springside.modules.orm.Page<T> getAll(org.springside.modules.orm.Page<T> page) ;
//
//    public org.springside.modules.orm.Page<T> findPage(org.springside.modules.orm.Page<T> page, java.lang.String hql, java.lang.Object... values) ;
//
//    public org.springside.modules.orm.Page<T> findPage(org.springside.modules.orm.Page<T> page, java.lang.String hql, java.util.Map<java.lang.String,?> values) ;
//
//    public org.springside.modules.orm.Page<T> findPage(org.springside.modules.orm.Page<T> page, org.hibernate.criterion.Criterion... criterions) ;



}
